For the localization problem in urban areas, where Global Positioning System (GPS) cannot provide the accurate location as its signal can be easily blocked by the high-rise buildings, a visual localization method based on vertical building facades and 2D bulding boundary map was proposed. Firstly, the vertical line features across two views, which are captured with an onboard camera, were matched into pairs. Then, the vertical building facades were reconstructed using the matched vertical line pairs. Finally, a visual localization method, which utilized the reconstructed vertical building facades and 2D building boundary map, was designed under the RANSAC (RANdom Sample Consensus) framework. The proposed localization method can work in real complex urban scenes. The experimental results show that the average localization error is around 3.6m, which can effectively improve the accuracy and robustness of self-localization of mobile robots in urban environments.